package com.nanbei.rabbit.consumer.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @ClassDescription:
 * @JdkVersion: 1.8
 * @Author: libs
 * @Created: 2024/8/28 15:34
 */
@Component
public class FanoutConsumerListener {

    @RabbitListener(queues = "fanout_queue_01")
    public void listener01(Message message){  //message 对象封装消息信息
        byte[] body = message.getBody();  // 获取的消息内容
        String msg = new String(body);
        System.out.println("fanout_queue_01:"+msg);
    }

    @RabbitListener(queues = "fanout_queue_02")
    public void listener02(Message message){  //message 对象封装消息信息
        byte[] body = message.getBody();  // 获取的消息内容
        String msg = new String(body);
        System.out.println("fanout_queue_02:"+msg);
    }

}
